using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class PORFQEntryMap : EntityTypeConfiguration<PORFQEntry>
    {
        public PORFQEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FBrNo, t.FInterID, t.FEntryID, t.FDetailID });

            // Properties
            this.Property(t => t.FNote)
                .HasMaxLength(255);

            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FMapNumber)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FMapName)
                .HasMaxLength(256);

            this.Property(t => t.FCustMtrlName)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FCustMtrlNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FSourceBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FDetailID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            // Table & Column Mappings
            this.ToTable("PORFQEntry");
            this.Property(t => t.FQtyFrom).HasColumnName("FQtyFrom");
            this.Property(t => t.FQtyTo).HasColumnName("FQtyTo");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FDescount).HasColumnName("FDescount");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FAuxPrice).HasColumnName("FAuxPrice");
            this.Property(t => t.FAuxQtyFrom).HasColumnName("FAuxQtyFrom");
            this.Property(t => t.FAuxQtyTo).HasColumnName("FAuxQtyTo");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FMapNumber).HasColumnName("FMapNumber");
            this.Property(t => t.FMapName).HasColumnName("FMapName");
            this.Property(t => t.FAuxPropID).HasColumnName("FAuxPropID");
            this.Property(t => t.FSelfDefinePrice1).HasColumnName("FSelfDefinePrice1");
            this.Property(t => t.FSelfDefinePrice2).HasColumnName("FSelfDefinePrice2");
            this.Property(t => t.FSelfDefinePrice3).HasColumnName("FSelfDefinePrice3");
            this.Property(t => t.FSelfDefinePrice4).HasColumnName("FSelfDefinePrice4");
            this.Property(t => t.FCustMtrlName).HasColumnName("FCustMtrlName");
            this.Property(t => t.FCustMtrlNo).HasColumnName("FCustMtrlNo");
            this.Property(t => t.FSourceTranType).HasColumnName("FSourceTranType");
            this.Property(t => t.FSourceInterId).HasColumnName("FSourceInterId");
            this.Property(t => t.FSourceBillNo).HasColumnName("FSourceBillNo");
            this.Property(t => t.FDetailID).HasColumnName("FDetailID");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FAuxPriceIncludeTax).HasColumnName("FAuxPriceIncludeTax");
            this.Property(t => t.FCess).HasColumnName("FCess");
            this.Property(t => t.FDiscountAmt).HasColumnName("FDiscountAmt");
            this.Property(t => t.FAmount).HasColumnName("FAmount");
            this.Property(t => t.FAmountIncludeTax).HasColumnName("FAmountIncludeTax");
            this.Property(t => t.FMRPClosed).HasColumnName("FMRPClosed");
            this.Property(t => t.FTaxAmount).HasColumnName("FTaxAmount");
            this.Property(t => t.FAuxTaxPriceDiscount).HasColumnName("FAuxTaxPriceDiscount");
            this.Property(t => t.FPriceUpdated).HasColumnName("FPriceUpdated");
            this.Property(t => t.FMapID).HasColumnName("FMapID");
        }
    }
}
